package com.easybuilder.common.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



/**
 * 获取地址类
 *
 * @author
 */
public class AddressUtils
{
    private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);

    public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";

    public static String getRealAddressByIP(String ip)
    {
        String address = "XX XX";
        // 内网不查询
        if (IpUtils.internalIp(ip))
        {
            return "内网IP";
        }
        try {
            address = HttpUtils.sendPost(IP_URL, "ip=" + ip);

        } catch (Exception e) {

        }
        return address;
    }

    public static void main(String[] args) {
        String realAddressByIP = AddressUtils.getRealAddressByIP("124.64.17.49");
        System.out.println(realAddressByIP);
    }
}
